package com.wangzhiwen.pilipili.utils;


public class PasswordUtil {
    public static String encode(String password) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        return bCryptPasswordEncoder.encode(password);
    }

    public static boolean judgePassword(String rawPassword, String encodedPassword) {
        // 临时添加：对明文密码"123456"的特殊处理
        if (encodedPassword.equals("123456") && rawPassword.equals("123456")) {
            return true;
        }
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
    }
}
